<template>
  <div id="app">
    <!-- 定义一个公共返回头 -->
    <div
      class="common_header"
      v-if="$route.name != 'Home' && $route.name != 'TrainStudyList'"
    >
      <div class="section_common_header">
        <i class="el-icon-back" @click="goBack"></i>
        <span>{{ $route.meta.title }}</span>
      </div>
    </div>
    <keep-alive>
      <router-view v-if="$route.meta.keepAlive">
        <!-- 这里是会被缓存的视图组件，比如 Home！ -->
      </router-view>
    </keep-alive>

    <router-view v-if="!$route.meta.keepAlive">
      <!-- 这里是不会被缓存的视图组件，比如 Profile！ -->
    </router-view>
  </div>
</template>
<script>
export default {
  methods: {
    goBack() {
      this.$router.go(-1);
    },
  },
};
</script>
<style lang="scss">
* {
  margin: 0;
  padding: 0;
  list-style: none;
  box-sizing: border-box;
  font-family: "Microsoft YaHei", 微软雅黑, "Helvetica Neue", Helvetica,
    "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
}

html,
body {
  width: 100%;
  height: 100%;
  background-color: #fff;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

.common_header {
  height: 40px;
  padding-left: 20px;
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  background-color: #ddd;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);

  .el-icon-back {
    cursor: pointer;
    font-size: 20px;
  }
}
.section_common {
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
}
// 构建公共页面根据不同屏幕适配的框架
@media screen and (min-width: 375px) {
  .section_common,
  .section_common_header {
    width: 350px;
    margin: 0 auto;
  }
  // html {
  //   /* iPhone6的375px尺寸作为16px基准，414px正好18px大小, 600 20px */
  //   font-size: calc(100% + 2 * (100vw - 375px) / 39);
  //   font-size: calc(16px + 2 * (100vw - 375px) / 39);
  // }
}

@media screen and (min-width: 414px) {
  .section_common,
  .section_common_header {
    width: 400px;
    margin: 0 auto;
  }
  // html {
  //   /* 414px-1000px每100像素宽字体增加1px(18px-22px) */
  //   font-size: calc(112.5% + 4 * (100vw - 414px) / 586);
  //   font-size: calc(18px + 4 * (100vw - 414px) / 586);
  // }
}

@media screen and (min-width: 600px) {
  .section_common,
  .section_common_header {
    width: 575px;
    margin: 0 auto;
  }
  // html {
  //   /* 600px-1000px每100像素宽字体增加1px(20px-24px) */
  //   font-size: calc(125% + 4 * (100vw - 600px) / 400);
  //   font-size: calc(20px + 4 * (100vw - 600px) / 400);
  // }
}

@media screen and (min-width: 1000px) {
  .section_common,
  .section_common_header {
    width: 960px;
    margin: 0 auto;
  }
  // html {
  //   /* 1000px往后是每100像素0.5px增加 */
  //   font-size: calc(137.5% + 6 * (100vw - 1000px) / 1000);
  //   font-size: calc(22px + 6 * (100vw - 1000px) / 1000);
  // }
}

body .el-table th.gutter {
  display: table-cell !important;
}

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}

// element相关样式调整
.el-form {
  padding-right: 10px;

  .el-form-item {
    display: flex;
    align-items: center;

    .el-form-item__content {
      margin-left: 10px !important;
    }

    .el-form-item__label {
      line-height: 20px;
    }

    .el-input__inner,
    .el-textarea__inner {
      width: 200px;
    }

    margin-bottom: 5px;
  }
}

.content_detail {
  p {
    img {
      width: 100% !important;
    }

    video {
      width: 100% !important;
    }

    radio {
      width: 100% !important;
    }
  }
}

// vant相关设置
.van-steps {
  .van-steps__items {
    .van-step__title {
      font-size: 14px !important;
    }
  }
}

.van-popup {
  .srwby {
    textarea.el-textarea__inner {
      /*border-color: #fea84f !important;*/
      border-color: #fea84f !important;
    }
  }
}
.clearfix:after {
  content: "020";
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}

.clearfix {
  zoom: 1;
}
</style>
